/**
 * https://leetcode.cn/problems/minimum-moves-to-capture-the-queen/submissions/585247697/?envType=daily-question&envId=2024-12-05
 */

class Solution {
public:
    int minMovesToCaptureTheQueen(int a, int b, int c, int d, int e, int f) {
        if(a==e&&(c!=e||abs(b-f)<abs(b-d)||abs(f-b)<abs(f-d))){
            cout<<"1";
            return 1;
        }
        if(b==f&&(d!=f||abs(a-e)<abs(a-c)||abs(a-e)<abs(e-c))){
            cout<<"2";
            return 1;
        }
        if(abs(d-f)==abs(e-c)&&(abs(b-d)!=abs(a-c)||abs(e-a)!=abs(b-f)||abs(d-f)<=abs(d-b)||abs(d-f)<abs(b-f))){
            cout<<"3";
            return 1;
        }
        return 2;
    }
};